package com.swanclouds.redfish.managers.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.DeviceEntity;

import java.util.List;
import java.util.Map;

public class LogServicesListModel implements DeviceEntity {

    //日志服务集合资源模型的id
    @JsonProperty("@odata.id")
    private String dataId;

    //日志服务集合资源模型的OData描述信息
    @JsonProperty("@odata.context")
    private String context;

   //日志服务集合资源模型的类型
    @JsonProperty("@odata.type")
    private String type;

    //日志服务集合资源的id
    @JsonProperty("Id")
    private String id;

    //日志服务集合资源的名称
    @JsonProperty("Name")
    private String name;

    //日志服务集合资源的描述信息
    @JsonProperty("Description")
    private String description;

    //当前日志服务资源数量
    @JsonProperty("Members@odata.count")
    private String membersCount;

    //日志服务资源列表
    //日志服务资源列表
    @JsonProperty("Members")
    private List<Map<String,Object>> members;

    @JsonProperty("EntryType")
    private String entryType;

    @JsonProperty("Severity")
    private String severity;

    @JsonProperty("Created")
    private String created;

    @JsonProperty("EntryCode")
    private String entryCode;

    @JsonProperty("EventTimestamp")
    private String eventTimestamp;

    @JsonProperty("SensorType")
    private String sensorType;

    @JsonProperty("SensorNumber")
    private Integer sensorNumber;

    @JsonProperty("Message")
    private String message;

    @Override
    public String getDataId() {
        return this.dataId;
    }

    @Override
    public String getContext() {
        return this.context;
    }

    @Override
    public String getType() {
        return this.type;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public List<Map<String,Object>> getMembers() {
        return this.members;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "LogServicesListModel{" +
                "dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", membersCount='" + membersCount + '\'' +
                ", members=" + members +
                ", entryType='" + entryType + '\'' +
                ", severity='" + severity + '\'' +
                ", created='" + created + '\'' +
                ", entryCode='" + entryCode + '\'' +
                ", eventTimestamp='" + eventTimestamp + '\'' +
                ", sensorType='" + sensorType + '\'' +
                ", sensorNumber=" + sensorNumber +
                ", message='" + message + '\'' +
                '}';
    }
}
